package simple05;

import java.util.concurrent.atomic.AtomicInteger;
//饿汉式
public class SessionCount {
    private AtomicInteger count = new AtomicInteger();
    private static SessionCount instance = new SessionCount();

    private SessionCount() {
    }

    public static SessionCount getInstance() {
        return instance;
    }

    public int plus() {
        return count.incrementAndGet();
    }

    public int decrease() {
        return count.decrementAndGet();
    }

    public void showMessage() {
        System.out.println("当前人数" + this.count.get());
    }
}
